<style>
.coutag {padding:0.1rem 0.2rem;background:#ffedef;color:#db2e2a;font-size:0.55rem;border-radius: 0.2rem;}
.storelogo img {
    width: 2.2rem;
    height: 2.2rem;
}
</style>
<div style="margin: 0 0.5rem;">
	<div class="fui-cell-group" style="margin-top:0;border-radius:0.5rem">
		<div class="fui-cell" style="padding:0.65rem 0.5rem">
			  <div class="fui-cell-label bold" style="width:auto">附近商户 </div>
			  <div class="fui-cell-info"></div>
			  <div class="fui-cell-remark" href="javascript:;" ng-click="access_json('jy_merch/index/')">更多</div>
		 </div>
	</div>
	<div ng-repeat="item in pagedata.merchlist" class="fui-list-group" style="margin-top:0;margin-bottom:0.3rem;border-radius:0.5rem">
	<div class="fui-list" style="align-items:flex-start;padding-bottom:0">
				<div class="fui-list-media storelogo" href="javascript:;" ng-click="access_json('jy_merch/myshop//id='+item.id)">
					<img class="round" ng-src="{{tomedia(item.logo) || '../addons/jy_merch/resource/images/nologo.png'}}">
				</div>
				<div class="fui-list-inner">
							<div href="javascript:;" ng-click="access_json('jy_merch/myshop//id='+item.id)" class="title" style="font-size:0.76rem">
								<span class="fui-tag fui-tag-danger" style="background:linear-gradient(to right,rgba(244,221,187,0.6),rgba(235,216,174,1));color:#512f0a;width:auto;font-weight:400">推荐商户</span>
								<span class="bold">{{item.merchname}}</span>
							</div>
							<div class="subtitle">
								<span class="coutag" style="margin-left:0.2rem">{{item.goodsnum || 0}}款</span>
								<span ng-if="item.coupons.length>0" class="coutag" ng-click="access_json('jy_weishop/coupon.index//merchid='+item.id)">
								 领券:<span ng-repeat="c in item.coupons" style="padding:0.1rem;">{{c.title}}<span ng-if="$index+1!=item.coupons.length" style="padding-left:0.2rem">|</span></span>
								</span>
							</div>
				</div>
				<div class="fui-list-angle" style="margin-right:0;padding-top:0.3rem">
					<span href="javascript:" ng-click="access_json('jy_merch/myshop//id='+item.id)" class="btn btn-sm btn-red" style="padding:0 0.5rem;border-radius:1rem;font-weight:400;">进入店铺 ></span>
				</div>
		</div>
		<div ng-if="item.goods.length>0" class="fui-goods-group block" style="padding-bottom:0">
					<div class="fui-cell-scroll">
							<div ng-repeat="g in item.goods" href="javascript:;" ng-click="access_json('jy_merch/myshop//id='+item.id+'&goodsid='+g.id)" class="fui-goods-item item" style="float:none;position: relative;width:6rem;border-bottom: 0 solid #e7e7e7">
										<div ng-class="{'image':1, 'echelon':item.active.title}" data-text="{{item.active.title}}" style="height:3.5rem;position:relative;background-image: url('{{tomedia(g.image) ||'../addons/jy_merch/resource/images/nologo.png'}}')">
												<div ng-show="g.total <=0" class="salez" style="background-image: url('{{tomedia(pagedata.shopset.shop.saleout)}}'); "></div>
												<div ng-if="g.video" class="playbtn"><i class="icon icon-iconfontplay2" style="font-size:1.6rem;"></i></div>
										</div>
										<div class="detail" style="padding-left:0;">
											<div class="name" style="font-size:0.6rem:color:#999">
												{{g.title}}
											</div>
											<div class="price" style="color:#fb5032;margin-top: 0;font-size:0.8rem">
												￥{{g.active.price || g.price}}
											</div>
										</div>
							</div>
					</div>
		</div>
		<div ng-if="!item.goods || item.goods.length<1" class='content-empty' style="margin-top:0">
				<i class='icon icon-cart1' style="font-size:2rem"></i>
				<div style="padding-bottom:0.5rem">该商户没有任何商品！</div>
		</div>
	</div>
	<div ng-if="!loading && (!pagedata.merchlist || pagedata.merchlist.length<1)" class='content-empty' style="margin-top:0">
			<i class='icon icon-lianxishangjia'></i>
			<div ng-click="pagedata.uplocation()">{{pagedata.pcd.district?'附近暂无任何相关店铺':'点击开启定位，显示附近店铺'}}</div>
	</div>
</div>
<script type="text/javascript">
scope.pagedata.merchsloading=true
scope.pagedata.getmerchs=function(item){
	var lat_lng=scope.pagedata.lat_lng?scope.pagedata.lat_lng:{};
	scope.get('jy_weishop/get_data/getmerchs/limit=5&lat='+lat_lng.lat+'&lng='+lat_lng.lng,function(res){
		scope.pagedata.merchlist=res.list
		scope.pagedata.merchsloading=false
		scope.$evalAsync();
	});
}
scope.pagedata.uplocation=function(){
	if(!scope.pagedata.lat_lng && !scope.main.lat_lng){
		// 百度地图API功能
		scope.pagedata.setting=scope.pagedata.setting?scope.pagedata.setting:{}
		window.scope.location(function(re){
			scope.pagedata.lat_lng=re.lat_lng;
			scope.main.lat_lng=re.lat_lng;
			scope.pagedata.getmerchs();
		},scope.pagedata.setting.no_location);
	}else{
		scope.pagedata.getmerchs();
	}
}
scope.pagedata.uplocation();
</script>